<template>
  <u-form-grid :data="formGrid" :filterParams="gridQueryParams" ref="child"></u-form-grid>
</template>

<script>
  import values from '../../utils/values'

  export default {
    name: 'GoodsSalesSpec',
    props: {
      filterParams: {
        type: Object,
        default: function () {
          return {}
        }
      },
    },
    watch: {
      //监听变量发生变化，将新的变量给查询参数。
      filterParams: {
        handler(curVal, oldVal) {
          this.gridQueryParams = curVal;
        },
        deep: true
      }
    },
    data() {
      return {
        gridQueryParams:{},
        formGrid: {
          options: {
            autoLoad:false,
            version: 'v2',
            url: {
              page: "/goodsSalesSpec/page",
              save: "/goodsSalesSpec/save",
              delete: "/goodsSalesSpec/delete",
            }
          },
          tips: {title: "销售规格", content: "销售规格"},
          toolbar: {
            create: {
              show: false, label: "添加"
            },
            delete: {
              show: false, label: "删除"
            },

          },
          form: {

          },
          table: {
            operation: {
              primaryKey: "id",
            },
            columns: [
              {title: '匹配值', key: 'specValueFullPathValue'},
              {title: '匹配名称', key: 'specValueFullPathName'},
              {title: '内部编号', key: 'sn'},
              {title: '产品名称', key: 'name'},
              {title: '车型', key: 'ext2'},
              {title: '原始价', key: 'originPrice'},
              {title: '销售价', key: 'price'},
              {title: 'VIN(5.11.8)', key: 'ext3'},
            ]
          }
        }
      }
    },
    mounted() {
      this.$nextTick(function () {
        //添加监听器
        //table重新加载
        this.$on('reloadData', () => {
          this.$refs.child.$emit('reloadData');
        });
      })
    }
  }
</script>
